<?php
/**
 * Created by PhpStorm.
 * User: RagPanda
 * Date: 2016/3/9
 * Time: 15:21
 */

namespace App\Http\Controllers\Admin;


use App\Http\Controllers\Controller;
use MyClass\Base\GuiFunction;
use MyClass\User\Account;
use MyClass\User\user;

//GuiFunction $gui ,

/**
 * Class AccountController
 * @package App\Http\Controllers\Admin
 */
class AccountController extends Controller  //zc
{
    /**
     * @param GuiFunction $guiFunc
     */
    public function __construct(GuiFunction $guiFunc)
    {
        $guiFunc->setModule("Manage");
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function sAccount()
    {
         $query_limit["desc"] = true;
        // $query_limit["class"] = 2;
      //  $query_limit["user"] = 2;
      // $query_limit["start"] = 2;
        $query_limit["num"] = 2;
       //   $query_limit["search"] = "c";
        $query_limit["paginate"] = 2;

        $data = Account::select($query_limit);

        // dump($data["total"]);
       // dump($data);
        exit(1);
      //  return view("Admin.Manage.sAccount");
    }

    /**
     *
     */
    public function aAccount()
    {
      //  $inputData["account_class"] = 10;
        $inputData["account_user"] = 1;
        $inputData["account_class"] = 2;
        $inputData["account_other_data"] = "�ƶ��Ƕ�";

       $return = Account::add($inputData);
        if($return)
        {
           echo "yes";
            exit(1);
        }
        echo "no";
    }

    public function dAccount($account_id)
    {

        $class = new Account($account_id);
        $return = $class -> delete();   //delete()��ȷ
        if($return)
        {
            echo "yes";
            exit(1);
        }
        else
        {
            echo "no";
            exit(1);
        }

    }
    public function uAccount() //��ʵ����ʱҪ��·�ɸ�Ϊpost
    {
        $inputData["account_class"] = 5;
        $inputData["account_user"] = 1;
        $class = new Account(3);
        $return = $class -> update($inputData); //delete()��ȷ
        if($return)
        {
            echo "yes";
            exit(1);
        }
        else
        {
            echo "no";
            exit(1);
        }

    }







}